package com.study.spring.ch01.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.logging.log4j.LogManager;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import org.apache.logging.log4j.Logger;

public class HelloWorldController implements Controller{

	static Logger LOGGER = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
	
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		
		ModelAndView mv=new ModelAndView();
		mv.addObject("message","ch01-HelloWorld!");
		mv.setViewName("ch01/hello");
		LOGGER.info("into helloworld controller");
//		LOGGER.trace("trace message");
//	    LOGGER.debug("debug message");
//	    LOGGER.info("info message");
//	    LOGGER.warn("warn message");
//	    LOGGER.error("error message");
//        LOGGER.fatal("fatal message"); 
		return mv;
	}

}
